Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 0e552d4b9d4ab9ed107fef8a2e4bd5a82886a378


Parents : 922dd91
Author : Mark Qvist <mark@unsigned.io>
Date : 2025-05-06T19:11:54+02:00

Added link mode to object details screen

Changes

2 files changed, 41 insertions(+), 2 deletions(-)


Diff

diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py
index be15a902..7a17b8a5 100644
--- a/sbapp/sideband/core.py
+++ b/sbapp/sideband/core.py
@@ -148,7 +148,7 @@ class SidebandCore():
self.log_announce(destination_hash, app_data, dest_type=SidebandCore.aspect_filter, stamp_cost=sc, link_stats=link_stats)
- def __init__(self, owner_app, config_path = None, is_service=False, is_client=False, android_app_dir=None, verbose=False, quiet=False, owner_service=None, service_context=None, is_daemon=False, load_config_only=False):
+ def __init__(self, owner_app, config_path = None, is_service=False, is_client=False, android_app_dir=None, verbose=False, quiet=False, owner_service=None, service_context=None, is_daemon=False, load_config_only=False, rns_config_path=None):
self.is_service = is_service
self.is_client = is_client
self.is_daemon = is_daemon
@@ -209,7 +209,7 @@ class SidebandCore():
self.cache_dir = self.app_dir+"/cache"
- self.rns_configdir = None
+ self.rns_configdir = rns_config_path
core_path = os.path.abspath(__file__)
if "core.pyc" in core_path:
@@ -1960,6 +1960,38 @@ class SidebandCore():
RNS.log(ed, RNS.LOG_DEBUG)
return None
+ def _get_destination_lmd(self, destination_hash):
+ try:
+ mr = self.message_router
+ oh = destination_hash
+ ol = None
+ if oh in mr.direct_links:
+ ol = mr.direct_links[oh]
+ elif oh in mr.backchannel_links:
+ ol = mr.backchannel_links[oh]
+
+ if ol != None: return ol.get_mode()
+
+ return None
+
+ except Exception as e:
+ RNS.trace_exception(e)
+ return None
+
+ def get_destination_lmd(self, destination_hash):
+ if not RNS.vendor.platformutils.is_android():
+ return self._get_destination_lmd(destination_hash)
+ else:
+ if self.is_service:
+ return self._get_destination_lmd(destination_hash)
+ else:
+ try:
+ return self.service_rpc_request({"get_destination_lmd": destination_hash})
+ except Exception as e:
+ ed = "Error while getting destination link mode over RPC: "+str(e)
+ RNS.log(ed, RNS.LOG_DEBUG)
+ return None
+
def __start_rpc_listener(self):
try:
RNS.log("Starting RPC listener", RNS.LOG_DEBUG)

diff --git a/sbapp/ui/objectdetails.py b/sbapp/ui/objectdetails.py
index 0de4f3db..e61b36e9 100644
--- a/sbapp/ui/objectdetails.py
+++ b/sbapp/ui/objectdetails.py
@@ -830,12 +830,19 @@ class RVDetails(MDRecycleView):
ler = self.delegate.app.sideband.get_destination_establishment_rate(self.delegate.object_hash)
mtu = self.delegate.app.sideband.get_destination_mtu(self.delegate.object_hash) or RNS.Reticulum.MTU
edr = self.delegate.app.sideband.get_destination_edr(self.delegate.object_hash)
+ lmd = self.delegate.app.sideband.get_destination_lmd(self.delegate.object_hash)
if ler:
lers = RNS.prettyspeed(ler, "b")
mtus = RNS.prettysize(mtu)
edrs = f"{RNS.prettyspeed(edr)}" if edr != None else ""
self.entries.append({"icon": "lock-check-outline", "text": f"Link established, LER is [b]{lers}[/b], MTU is [b]{mtus}[/b]", "on_release": pass_job})
if edr: self.entries.append({"icon": "approximately-equal", "text": f"Expected data rate is [b]{edrs}[/b]", "on_release": pass_job})
+ if lmd != None:
+ if lmd in RNS.Link.MODE_DESCRIPTIONS: lmds = RNS.Link.MODE_DESCRIPTIONS[lmd]
+ else: lmds = "unknown"
+ if lmds == "AES_128_CBC": lmds = "X25519/AES128"
+ elif lmds == "AES_256_CBC": lmds = "X25519/AES256"
+ self.entries.append({"icon": "link-lock", "text": f"Link mode is [b]{lmds}[/b]", "on_release": pass_job})
except Exception as e:
RNS.trace_exception(e)


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────